<% if current_user && !current_user.remember_created_at %>
  <% timeout_time_seconds = Decidim.config.expire_session_after.to_i %>
  <% prevent_timeout_for = try(:prevent_timeout_seconds) || 0 %>

  <%= decidim_modal id: "timeoutModal", data: {
        "seconds-until-timeout-path": decidim.seconds_until_timeout_path,
        "heartbeat-path": decidim.heartbeat_path,
        "session-timeout": timeout_time_seconds,
        "prevent-timeout-seconds": prevent_timeout_for,
        "session-timeout-interval": Decidim.config.session_timeout_interval.to_i * 1000
      } do %>
    <div data-dialog-container>
      <%= icon "timer-line" %>
      <h3 id="dialog-title-timeoutModal" data-dialog-title><%= t("title", scope: "layouts.decidim.timeout_modal") %></h3>
      <div>
        <p id="dialog-desc-timeoutModal"><%= t("body", scope: "layouts.decidim.timeout_modal", minutes: (timeout_time_seconds / 60) - 2) %></p>
      </div>
    </div>

    <div data-dialog-actions>
      <%= link_to t("log_out", scope: "layouts.decidim.timeout_modal"), decidim.destroy_user_session_path, method: :delete, class: "button button__sm md:button__lg button__transparent-secondary" %>
      <%= link_to "", decidim.destroy_user_session_path(translation_suffix: :timed_out), method: :delete, id: "reveal-hidden-sign-out", class: "hidden" %>

      <%= button_to t("continue_session", scope: "layouts.decidim.timeout_modal"),
                    decidim.heartbeat_path,
                    id: "continueSession",
                    class: "button button__sm md:button__lg button__secondary",
                    remote: true,
                    method: :post %>
    </div>
  <% end %>
<% end %>
